package com.mp.approvalreq.dao;


import com.mp.approvalreq.entity.MessageRead;
import com.mp.approvalreq.entity.dto.RedPointDTO;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

public interface RedDao {

    /**
     * 获取该用户所有红点的审批ids
     *
     * @param companyInfoId
     * @return
     * @throws SQLException
     */
    List<Integer> getAllRedPointRequestIds(Integer companyInfoId) throws SQLException;

    /**
     * 消除这些审批的未读红点
     *
     * @param requestIds
     * @param companyInfoId
     * @throws SQLException
     */
    void clearRedPointByRequestIds(String requestIds, Integer companyInfoId) throws SQLException;

    /**
     * 消除未读红点
     *
     * @param requestId
     * @param companyInfoId
     * @throws SQLException
     */
    void deleteUserRedPoint(Integer requestId, Integer companyInfoId) throws SQLException;

    /**
     * 消除该审批的所有相关人群的红点
     *
     * @param requestId
     * @throws SQLException
     */
    void deleteRedPointByRequestId(Integer requestId) throws SQLException;


    /**
     * 我申请的待处理
     *
     * @param companyId
     * @param contactId
     * @return
     * @throws SQLException
     */
    List<Integer> getMyApplyInApproving(Integer companyId, Integer contactId) throws SQLException;


    /**
     * 我申请的已处理
     *
     * @param companyId
     * @param contactId
     * @return
     * @throws SQLException
     */
    List<Integer> getMyApplyHasApproved(Integer companyId, Integer contactId) throws SQLException;


    /**
     * 抄送我的审批
     *
     * @param companyId
     * @param companyInfoId
     * @return
     * @throws SQLException
     */
    Map<String, List<Integer>> getCcToMeMap(Integer companyId, Integer companyInfoId) throws SQLException;

    /**
     * 我已归档的有红点
     *
     * @param companyId
     * @param companyInfoId
     * @param requestIds
     * @return
     * @throws SQLException
     */
    List<Integer> getMyArchivedHasRed(Integer companyId, Integer companyInfoId, String requestIds) throws SQLException;


    /**
     * 获取该用户所有的未读红点
     *
     * @param companyInfoId
     * @return
     * @throws SQLException
     */
    List<RedPointDTO> getUserRedPointList(Integer companyInfoId) throws SQLException;

    /**
     * 获取用户审批红点信息
     *
     * @param companyInfoId
     * @return
     * @throws SQLException
     */
    Map<Integer, List<MessageRead>> selectUserRedPointMap(Integer companyInfoId) throws SQLException;

    /**
     * 根据审批查看用户红点
     *
     * @param requestId
     * @param companyInfoId
     * @return
     * @throws SQLException
     */
    List<MessageRead> selectRequestUserRedPoint(Integer requestId, Integer companyInfoId) throws SQLException;

    /**
     * 查询审批所有红点
     *
     * @param requestId
     * @return
     * @throws SQLException
     */
    List<MessageRead> selectRedPointByRequestId(Integer requestId) throws SQLException;

    /**
     * 标记消息未读状态
     *
     * @param redPointDTO
     * @throws SQLException
     */
    void updateMessageUnRead(RedPointDTO redPointDTO) throws SQLException;

    /**
     * 查看评论消红点时间
     *
     * @param companyInfoId
     * @param commentIds
     * @return
     * @throws SQLException
     */
    Map<Integer, String> selectCommentReadTimeMap(Integer companyInfoId, String commentIds) throws SQLException;

    /**
     * 获取评论红点信息
     *
     * @param redPointDTO
     * @throws SQLException
     */
    MessageRead selectMessageReadInfo(RedPointDTO redPointDTO) throws SQLException;

    void insertBatchRedPoints(List<MessageRead> messageReads) throws SQLException;
}
